<?php

namespace App\Enums;

use App\Models\Notifiable;
use App\Models\Order;
use App\Models\Refund;
use App\Models\User;
use Exception;

enum PushUri: string
{
    case USER = '/api/user/info';

    case ORDER = '/api/order';

    case REFUND = '/api/refund';

    /**
     * @throws Exception
     */
    public static function getUri(Notifiable $model): string
    {
        if ($model instanceof User) {
            return self::USER->value;
        } elseif ($model instanceof Order) {
            return self::ORDER->value;
        } elseif ($model instanceof Refund) {
            return self::REFUND->value;
        } else {
            throw new Exception('模型不正确');
        }
    }
}
